import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AdminModelModule } from './model/admin-model/admin-model.module';
import { BaseModelModule } from './model/base-model/base-model.module';

import config from './config'
import { TypeOrmModule } from '@nestjs/typeorm';
import { RedisModule } from './redis/redis.module';
import { AdminModule } from './modules/admin/admin/admin.module';
import { XjwtModule } from './xjwt/xjwt.module';
import { DistrictModule } from './modules/district/district.module';
import { DistrictModelModule } from './model/district-model/district-model.module';
import { MerchantModelModule } from './model/merchant-model/merchant-model.module';
import { MerchantModule } from './modules/admin/merchant/merchant.module';
import { IotSimModelModule } from './model/iot-sim-model/iot-sim-model.module';
import { IotSimModule } from './modules/admin/iot-sim/iot-sim.module';
import { DeviceModule } from './modules/device/device.module';
import { DeviceModelModule } from './model/device-model/device-model.module';
import { DevicePortModelModule } from './model/device-port-model/device-port-model.module';
import { SystemMenuModelModule } from './model/system-menu-model/system-menu-model.module';
import { SystemModule } from './modules/system/system.module';
import { PermissionRuleModelModule } from './model/permission-rule-model/permission-rule-model.module';
import { PermissionRoleModelModule } from './model/permission-role-model/permission-role-model.module';
import { ChargeStrategyModelModule } from './model/charge-strategy-model/charge-strategy-model.module';
import { ChargeStrategyModule } from './modules/charge-strategy/charge-strategy.module';
import { LoginModule } from './modules/login/login.module';
import { PermissionModule } from './modules/permission/permission.module';
import { MqttModule } from './mqtt/mqtt.module';
import { ChargeOrderModelModule } from './model/charge-order-model/charge-order-model.module';
import { ChargeOrderModule } from './modules/charge-order/charge-order.module';
import { DictionaryCategoryModule } from './modules/dictionary-category/dictionary-category.module';
import { DictionaryCategoryModelModule } from './model/dictionary-category-model/dictionary-category-model.module';
import { DictionaryItemModelModule } from './model/dictionary-item-model/dictionary-item-model.module';
import { DictionaryItemModule } from './modules/dictionary-item/dictionary-item.module';
import { RechargeOptionModelModule } from './model/recharge-option-model/recharge-option-model.module';
import { RechargeModule } from './modules/recharge/recharge.module';

@Module({
  imports: [
    ConfigModule.forRoot({
      isGlobal : true,
      load : [config]
    }),

    TypeOrmModule.forRootAsync({
      inject : [ConfigService],
      useFactory : (configService:ConfigService) => configService.get('database')
    }),

    AdminModelModule, BaseModelModule, AdminModule, RedisModule, XjwtModule, AdminModule, DistrictModule, DistrictModelModule, MerchantModelModule, MerchantModule, IotSimModelModule, IotSimModule, DeviceModule, DeviceModelModule, DevicePortModelModule, SystemMenuModelModule, SystemModule, PermissionRuleModelModule, PermissionRoleModelModule, ChargeStrategyModelModule, ChargeStrategyModule, LoginModule, PermissionModule, MqttModule, ChargeOrderModelModule, ChargeOrderModule, DictionaryCategoryModule, DictionaryCategoryModelModule, DictionaryItemModelModule, DictionaryItemModule, RechargeOptionModelModule, RechargeModule
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
